package com.vueblog.webapi.response;

import com.vueblog.webapi.enums.ResponseEnum;
import com.vueblog.webapi.utils.I18nUtils;
import lombok.Data;

/**
 * CommonResponse
 *
 * @author PengHang
 * @since 2020/8/17
 */
@Data
public class CommonResponse {
    /**
     * 返回编码
     */
    private Integer code;

    /**
     * 返回消息
     */
    private String message;

    public CommonResponse() {
    }

    public CommonResponse(Integer code, String message) {
        this.code = code;
        this.message = I18nUtils.getKey(message);
    }
    public CommonResponse(ResponseEnum responseEnum) {
        this(responseEnum.getCode(), responseEnum.getMessage());
    }
}
